package club.chenlinghong.order.client;

import club.chenlinghong.order.dto.CartDTO;
import club.chenlinghong.order.entity.ProductInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Description TODO
 * @Author chenlinghong
 * @Date 2019/7/1 14:49
 * @Version V1.0
 */
@FeignClient(name = "product")
public interface ProductClient {

    @GetMapping("/msg")
    String productMsg();

    /**
     * 获取商品列表
     *
     * @param productIdList
     * @return
     */
    @PostMapping(value = "/product/listForOrder")
    List<ProductInfo> listForProduct(@RequestBody List<String> productIdList);

    /**
     * 扣库存
     *
     * @param cartDTOList
     */
    @PostMapping(value = "/product/decreaseStock")
    void decreaseStock(@RequestBody List<CartDTO> cartDTOList);

}
